package com.esunny.db.hbase;

import java.util.HashMap;
import java.util.HashSet;
import java.util.Random;
import java.util.Vector;

public class ScanAction extends Action {

    private Random                          random      = new Random();
    private HashSet<String>                 fields      = null;
    private Vector<HashMap<String, String>> scanResults = null;

    @Override
    public void before() {
        int keynum = random.nextInt(this.keySpace);
        key = "user" + keynum;
        scanResults = new Vector<HashMap<String, String>>();
        // HashSet<String> s = new HashSet<String>();
        // for (int i = 1; i < this.fieldSize; i++) {
        // s.add("field" + i);
        // }
    }

    @Override
    public int execute() {
        return cli.scan(this.tableName, "user2", 20, fields, scanResults);
    }

    @Override
    public void after() {
        fields = null;
        scanResults = null;
    }
}
